<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
    <link rel="stylesheet" href="/loading.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <title>活动</title>
  </head>

  <body>
    <div id="app">
      <div class="loader">
        <div class="loader-text" data-text="加载中...">加载中...</div>
      </div>
    </div>
    <script type="module" src="/src/main.ts"></script>
    <script>
      var del_times = 0
      // 定时器
      var deTimer = null
      function adGo() {
        // 获取广告iframe
        var iframe = document.getElementsByTagName('iframe')[0]
        if (iframe) {
          // 循环 iframe 父类，直到找到body和body的下一级，然后整个嵌入的代码删除。
          var bodyNode = { tagName: '' }
          var iframeParent = null
          var targetNode = iframe.parentNode
          while (bodyNode.tagName !== 'BODY') {
            bodyNode = targetNode
            if (bodyNode.tagName !== 'BODY') {
              iframeParent = targetNode
              targetNode = targetNode.parentNode
            }
          }
          iframeParent ? bodyNode.removeChild(iframeParent) : bodyNode.removeChild(iframe)
        }
        del_times++
        if (del_times > 10) window.clearInterval(deTimer)
      }
      deTimer = self.setInterval(adGo, 1000)
    </script>
  </body>
</html>
